/**
 * 
 */
package br.com.maps.util.report.impl;

import java.util.Map;

import jmine.tec.report.ExecutableDataRow;
import jmine.tec.report.impl.AbstractExecutableDataColumn;
import jmine.tec.report.metadata.ParameterDefinition;
import jmine.tec.report.metadata.ParameterType;

/**
 * @author takeshi
 * @version 24/08/2007
 */
public class SimpleExecutableDataColumn extends AbstractExecutableDataColumn {

    /**
     * 
     */
    public static final String PARAMETER = "a";

    /**
     * 
     */
    private static final long serialVersionUID = 1L;

    /**
     * C'tor
     */
    public SimpleExecutableDataColumn() {
        super(PARAMETER, "b", new ParameterDefinition(PARAMETER, PARAMETER, null, ParameterType.NUMBER));
        this.addDefaultParameterValue("a", Double.valueOf(-1));
    }

    /**
     * @param row the {@link ExecutableDataRow}
     * @param params the params
     */
    @Override
    protected void executeDefaultRow(final ExecutableDataRow row, final Map<String, Object> params) {
        Double val = (Double) this.getParameterValue(PARAMETER, params);
        if (val == null) {
            row.addCell(this.getEmptyDataCell());
        } else {
            row.addDoubleDataCell(val);
        }
        this.recurseChildRows(row, params);
    }

}
